package com.example.demo;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;

/**
 * @Author: Administrator
 * @Date: 2020/12/24 19:30
 */
public class ProductLoader extends URLClassLoader {

    public ProductLoader(URL[] urls, ClassLoader parent) {
        super(urls, parent);
    }

    public ProductLoader(URL[] urls) {
        super(urls);
    }

    @Override
    public Class<?> loadClass(String name) throws ClassNotFoundException {
        return super.loadClass(name);
    }


    public void addJar(String file) throws MalformedURLException {
        addURL(new File(file).toURI().toURL());
    }
}
